﻿using System.Web;
using System.Web.UI;
using Cms.Web.Framework.Infrastructure;

namespace Cms.Web.Framework.Plugins
{
    public abstract class BasePlugin : UserControl
    {
        public RequestDetails RequestDetails { get; set; }

        public override void RenderControl(HtmlTextWriter writer)
        {
            EnsureChildControls();
            base.RenderControl(writer);
        }

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            RequestDetails = (RequestDetails)HttpContext.Current.Items["RequestDetails"];
            if (RequestDetails == null || RequestDetails.Page == null)
                return;
        }
    }
}